package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.SystemAuthorityList;
import com.group.project.hrms.mapper.SystemAuthorityListMapper;
import com.group.project.hrms.service.ISystemAuthorityListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class SystemAuthorityListService implements ISystemAuthorityListService {

    @Autowired
    private SystemAuthorityListMapper systemAuthorityListMapper;


    @Override
    public int insertSystemAuthorityList(SystemAuthorityList systemAuthorityList) {
        return systemAuthorityListMapper.insert(systemAuthorityList);
    }

    @Override
    public int deleteSystemAuthorityList(SystemAuthorityList systemAuthorityList) {
        return systemAuthorityListMapper.deleteByPrimaryKey(systemAuthorityList);
    }

    @Override
    public int updateSystemAuthorityList(SystemAuthorityList systemAuthorityList) {
        return systemAuthorityListMapper.updateByPrimaryKey(systemAuthorityList);
    }

    @Override
    public SystemAuthorityList selectOneSystemAuthorityList(SystemAuthorityList systemAuthorityList) {
        return systemAuthorityListMapper.selectByPrimaryKey(systemAuthorityList);
    }

    @Override
    public SystemAuthorityList selectSystemAuthorityListByAuthorityId(String aid) {
        Example example = new Example(SystemAuthorityList.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.orEqualTo("authorityId" , aid);
        return systemAuthorityListMapper.selectOneByExample(example);
    }

    @Override
    public List<SystemAuthorityList> selectAllSystemAuthorityList() {
        return systemAuthorityListMapper.selectAll();
    }
}
